package com.cwj.blog.http

import com.cwj.blog.bean.BlogBean
import com.cwj.blog.bean.SuccessBean
import com.tencent.mmkv.MMKV
import io.reactivex.Observable
import retrofit2.http.Body
import retrofit2.http.GET
import retrofit2.http.POST
import retrofit2.http.Query

/**
 * 接口的管理类
 */
object API {
    const val BASE_URL = "http://123.56.143.27:9090/"
    @JvmField
    var kv = MMKV.defaultMMKV()

    interface Api {
        //博客查询
        @GET("blog/page")
        fun page(
            @Query("skip") skip: Int?, @Query("pageSize") pageSize: Int?,
            @Query("title") title: String?
        ): Observable<BlogBean?>?

        //博客添加
        @POST("blog")
        fun addBlog(@Body map: MutableMap<String, Any>): Observable<SuccessBean?>?
    }
}